Do not use core Airflow Flask related resources in FAB provider#45441
Merged
vincbeck merged 2 commits intoapache:mainfrom Jan 7, 2025
Merged
Do not use core Airflow Flask related resources in FAB provider#45441vincbeck merged 2 commits intoapache:mainfrom
vincbeck merged 2 commits intoapache:mainfrom
Conversation
providers/src/airflow/providers/fab/www/extensions/init_security.py
Dismissed
Show dismissed
Hide dismissed
vincbeck
commented
Jan 6, 2025
7eb4744 to
3294c71
Compare
3294c71 to
f3e31ca
Compare
jedcunningham
approved these changes
Jan 7, 2025
This was referenced Jan 7, 2025
|
|
||
| if TYPE_CHECKING: | ||
| from airflow.www.extensions.init_appbuilder import AirflowAppBuilder | ||
| from airflow.providers.fab.www.extensions.init_appbuilder import AirflowAppBuilder |
Contributor
There was a problem hiding this comment.
@vincbeck We don't have add_permissions() method in from airflow.providers.fab.www.extensions.init_appbuilder import AirflowAppBuilder class. Causing airflow sync-perm command to fail on the main branch.
Updating actions and resources for all existing roles
webserver | Traceback (most recent call last):
webserver | File "/usr/local/bin/airflow", line 8, in <module>
webserver | sys.exit(main())
webserver | ^^^^^^
webserver | File "/usr/local/lib/python3.12/site-packages/airflow/__main__.py", line 58, in main
webserver | args.func(args)
webserver | File "/usr/local/lib/python3.12/site-packages/airflow/cli/cli_config.py", line 49, in command
webserver | return func(*args, **kwargs)
webserver | ^^^^^^^^^^^^^^^^^^^^^
webserver | File "/usr/local/lib/python3.12/site-packages/airflow/utils/cli.py", line 111, in wrapper
webserver | return f(*args, **kwargs)
webserver | ^^^^^^^^^^^^^^^^^^
webserver | File "/usr/local/lib/python3.12/site-packages/airflow/utils/providers_configuration_loader.py", line 55, in wrapped_function
webserver | return func(*args, **kwargs)
webserver | ^^^^^^^^^^^^^^^^^^^^^
webserver | File "/usr/local/lib/python3.12/site-packages/airflow/providers/fab/auth_manager/cli_commands/sync_perm_command.py", line 35, in sync_perm
webserver | appbuilder.add_permissions(update_perms=True)
webserver | ^^^^^^^^^^^^^^^^^^^^^^^^^^
webserver | AttributeError: 'AirflowAppBuilder' object has no attribute 'add_permissions'. Did you mean: '_add_permission'?
Is there an alternative method we should use?
Contributor
Author
There was a problem hiding this comment.
Is it still happening? The solution would be to copy over add_permissions from core Airflow to FAB provider
Contributor
HariGS-DB
pushed a commit
to HariGS-DB/airflow
that referenced
this pull request
Jan 16, 2025
got686-yandex
pushed a commit
to got686-yandex/airflow
that referenced
this pull request
Jan 30, 2025
This was referenced Apr 6, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As part of AIP-79.
The Flask application in FAB provider should not use any Flask related resources from core Airflow. Otherwise, deleting the main Flask application in core Airflow when the legacy Airflow 2 is gone will be impossible.
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in newsfragments.